package com.gb.push.enums;

import lombok.Data;
import lombok.Getter;

/**
 * @Author: wgs
 * @Date 2022/3/14 14:37
 * @Classname CommonEnum
 * @Description
 */
public interface CommonEnum {

    @Getter
    enum DeviceEnum implements Ienum<Integer> {

        /**
         * 苹果
         */
        IOS(0, "苹果"),
        /**
         * 安卓
         */
        ANDROID(1, "安卓");;

        private Integer type;
        private String desc;

        DeviceEnum(int type, String desc) {
            this.type = type;
            this.desc = desc;
        }

        @Override
        public boolean is(Integer type) {
            return get().equals(type);
        }

        @Override
        public Integer get() {
            return type;
        }
    }

    interface Ienum<T> {
        /**
         * 判断当前值和传入值是否一致
         *
         * @param t
         * @return
         */
        boolean is(T t);

        /**
         * 获取枚举值
         *
         * @return
         */
        T get();
    }
}
